var _obj = { age: 18 }

// in
console.log("toString" in _obj); // true 
console.log("name" in _obj); // false
console.log("age" in _obj); // true


// Reflet
console.log(Reflect.has(_obj, "toString")); // true
console.log(Reflect.has(_obj, "name")); // false
console.log(Reflect.has(_obj, "age")); // true


// hasOwnProperty

console.log(_obj.hasOwnProperty("toString")); // false
console.log(_obj.hasOwnProperty("name")); // false
console.log(_obj.hasOwnProperty("age")); // true

function Person(){
    this.age = 18
}

Person.prototype.name = "tom"

var person = new Person()
console.log(person.hasOwnProperty("age"));  // true
console.log(person.hasOwnProperty("name")); // false
console.log(person.name); // tom

// 创建一个对象，对象的原型为null
var obj = Object.create(null)

// console.log(obj.hasOwnProperty("name")); // obj.hasOwnProperty is not a function 直接报错
console.log(Object.prototype.hasOwnProperty.call(obj,'name')); // false

var obj1 = {
    hasOwnProperty:function(){
        return false
    },
    name:"sunwukong"
}

console.log(obj1.hasOwnProperty('name')); // false
console.log(Object.prototype.hasOwnProperty.call(obj1,'name')); //true


console.log(Object.hasOwn(obj1,'name')); // true

